function lockLandscape() {
    window.addEventListener("orientationchange", function(){
        console.log(screen.orientation.type); // e.g. portrait
    });
    screen.orientation.lock('landscape');
}

function lockPortrait() {
    screen.orientation.lock('portrait');
}

function screenAny() {
    screen.orientation.unlock('portrait');
}